package com.skyline.common.util;

import java.util.Date;

public class CommonUtils {
	private static final String EMPTY_STRING = "";

	@SuppressWarnings("unchecked")
	public static <T extends Date> T cloneDate(T date) {
		if (date == null) {
			return null;
		} else {
			return (T) date.clone();
		}
	}

	public static String nullStringToEmpty(String str) {
		return str == null ? EMPTY_STRING : str;
	}

	public static String emptyStringToNull(String str) {
		return EMPTY_STRING.equals(str) ? null : str;
	}
}
